package com.wangx1n;

import com.wangx1n.config.BaseConfig;
import com.wangx1n.entity.User;
import com.wangx1n.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.LinkedList;
import java.util.List;

/**
 * @author WangXin
 * @date 2020/12/4 15:31
 */
public class myTest {
    @Test
    public void JdbcTemplateTest(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
        UserService userService = context.getBean("userService", UserService.class);
        User user = new User();
        user.setUserId(2);
        user.setUserName("ss2");
//        userService.addUser(user);
//        System.out.println(userService.selectUserCount());
//        System.out.println(userService.selectUser(1).getUserName());
//        System.out.println(userService.selectUsers());

        List<Object[]> batchArgs = new LinkedList<>();
        batchArgs.add(new Object[]{3});
        batchArgs.add(new Object[]{4});
        batchArgs.add(new Object[]{5});

        userService.batchDeleteUser(batchArgs);

    }

}
